A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the Patent and Trademark Office patent file or records but otherwise reserves all copyright rights whatsoever.
1. Technical Field
The present invention relates generally to Internet publishing technologies and, in particular, to techniques for dynamically-serving web page content.
2. Description of the Related Art
A Hypertext Markup Language (HTML) file uses a limited set of tags to convey basic information about the structure of a web document, e.g., whether given text is a heading or a paragraph. With HTML, the style and logic of the document are hardcoded. HTML does not provide tags that define the meaning of the page element. To address this limitation, web content is now being authored in extensible Markup Language (XML), which provides a way for an author to create a custom markup language to suit a particular kind of document. In XML, each document is an object, and each element of the document is an object. The logical structure of the document typically is specified in a Document Type Definition (DTD). A DTD may be used by the author to define a grammar for a set of tags for the document so that a given application may validate the proper use of the tags. A DTD comprises a set of elements and their attributes, as well as a specification of the relationship of each element to other elements. Once an element is defined, it may then be associated with a stylesheet, a script, HTML code or the like. Thus, with XML, an author may define his or her own tags and attributes to identify structural elements of a document, which may then be validated automatically. An XML document""s internal data structure representation is a Document Object Model (DOM). The DOM makes it possible to address a given XML page. element as a programmable object. It is basically a tree of all the nodes in an XML file.
Page serving technologies are evolving at a rapid pace. Since 1997, three new major technologies have attempted to supplement, if not replace, dynamically generated HTML, i.e. database or CGI scripts used to generate a web page on the fly. These technologies are Microsoft""s active server page (ASP), Sun Microsystems""s Java(trademark) server page (JSP), and the Extensible Style Sheet Language (XSL/XSLT) being promoted by the World Wide Web Consortium (W3C). They provide for the generation and serving of dynamic web page content by enabling a page creator to write HTML and then to embed pure programming logic inside the page markup. Microsoft""s ASP and Sun""s JSP are very similar in that they both are essentially web templates that enable given code (e.g., code written in Java(trademark)) to be embedded in static HTML to be served in response to a client browser request. In an illustrative example, a server (and, in particular, a Java(trademark) runtime servlet) responds to a client .jsp request as follows: the servlet retrieves a flat file corresponding to the requested page, translates that file into a Java(trademark) servlet, compiles the servlet, class loads the servlet, and then invokes the servlet to cause given (e.g., customized) web content to be returned to the requesting browser. XSL/XSLT, to the contrary, is rooted in formatting and manipulating XML. XSLT, in particular, provides extensible mechanisms for defining templates to manipulate XML of any custom DTD.
The existing techniques for serving dynamic content have various limitations. Conventional server-side scripting on a web page can be complicated and, therefore, such scripting is usually difficult to maintain and evolve. Further, with existing technologies, typically only a single scripting language is allowed on a web page. This limitation is acceptable, so long as only one author is responsible for editing the page, or if all of the responsible authors know and use the same scripting language and the language of choice is supported by the web server. Microsoft""s ASP technology supports multiple scripting languages, but only one language may be used on a page. Moreover, multiple languages cannot be embedded in one another, and their order of execution is undefined. Further, page-serving technologies such as ASP and JSP are not XML-compliant, and neither ASP nor JSP provides an extension mechanism to allow authors to add custom tags.
It is also known in the art to provide a web page author with a library of preexisting custom tags. An illustrative product of this type is Cold Fusion, which is HTML-centric. This product, however, does not afford the author the ability to create custom tags. Macromedial""s Dreamweaver product has a tag construction mechanism, but this product does not allow for the embedding of custom tags, nor does it allow the document to be reorganized by the tags. It also keeps the script code on the page. In particular, the script is hidden from the user, but it is still present on the page, and it may be viewed and/or edited from within another editor. However, the modifications made in another tool are not maintained. Microsoft provides a similar technology, called design-time control (DTC), that hides code from the user but still maintains the code on the page. DTC is not XML-compliant and it does not allow DTCs to be embedded within one another. Nor does the DTC mechanism allow the document to be reorganized. In addition, the DTC syntax is quite cumbersome for the page author. Moreover, while other DTC-aware tools will hide the script code correctly, basic text-editors can still edit the code, and the changes made will not be importable back into the DTC-aware tools. DTC also does not provide access to the Document Object Model. Other products or technologies that have custom tag extensions include HeiTML and Meta-HTML. Essentially, these are tag macro definition languages for HTML. Such languages, however, are not XML compliant.
There remains a need in the art to provide new techniques for publishing Internet content that can fully leverage the manipulation and template mechanism of XSLT with the scripting capability of the JSP/ASP model. The present invention addresses this need.
According to the present invention, different scripting languages may reside side-by-side or nested within each other on the same web page. Thus, a new author may add code to the page, and he or she is not tied to any given subset of languages supported by the web server. Multiple scripting languages are supported by identifying a start and an end of each scripting language code block authored into the web page markup language.
In the preferred embodiment, a web page such supporting multiple scripting languages is compiled into an XML (extensible Markup Language) DOM (Document Object Model), and, thereafter, into a Java(trademark) servlet. In the DOM stage, nodes designating scripting code blocks are identified. When encountered, the routine creates a new node representing a Java(trademark) method definition as a child of the root element, and replaces the block node with a node representing a Java(trademark) method call to the new method definition. The block""s child nodes are then moved under the method definition. Java(trademark) servlet code is then generated under the method definition to pass the script code contained in the block to an appropriate interpreter for the scripting language specified by the block""s language attribute.
Thus, according to the present invention, a method for supporting multiple scripting languages in a given web page begins by marking a start and an end of one or more given scripting language code blocks in the markup of the given web page. When the web page is compiled into an XML DOM, the routine examines the DOM to identify any nodes that identify a given code block. Upon encountering a node that identifies a given code block, the DOM is adjusted to account for the script code within the given code block.
The foregoing has outlined some of the more pertinent objects and features of the present invention. These objects should be construed to be merely illustrative of some of the more prominent features and applications of the invention. Many other beneficial results can be attained by applying the disclosed invention in a different manner or modifying the invention as will be described. Accordingly, other objects and a fuller understanding of the invention may be had by referring to the following Detailed Description of the Preferred Embodiment.